import store from "@/store";
import { getUserInfo } from "@/util/info.js";
const { http } = uni.$u;

export const config = {
	// baseUrl: 'https://yftx.xailife.com' //生产
	baseUrl: 'https://yftx-test.xailife.com' // 测试
	// baseUrl: 'https://yftx-dev.xailife.com' // 开发
	// baseUrl: 'https://yftx-map-test.xailife.com/prod-api' // 测试
	// baseUrl: 'http://10.34.100.127:32189'
}

// 登录
export const login = (data) => {
  return http.post("/prod-api/login", data);
};

// 验证码
export const getCodeImg = () => {
  return http.get("/prod-api/captchaImage");
};

// 用户信息
export const getInfo = () => {
  return http.get("/prod-api/getInfo");
};

export const homeSumQuery = async (data) => {
  // const level = await getUserInfo("userLevel")
  // if (['1', '2' , '5' ,'6'].includes(level)) {
  // 	const dataIsDeleted = {...data,isDeleted:0}
  // 	return http.get('/prod-api/station/order/homeSumQuery', {params:dataIsDeleted});
  // }else{
  return http.get("/prod-api/station/order/homeSumQuery", {
    params: data,
  });
  // }
};

// 退出登录
export const logout = (data) => {
  return http.post("/prod-api/logout", data);
};

// 油站列表
// export const getStationList = (data) => {
// 	return http.get('/prod-api/station/message/list', {params:data});
// }

// 修改的油站列表2023、10、1822,222,订单页面
export const getStationListJD = () => {
  return http.get("/prod-api/station/order/getStationByEnterprise");
};

// 修改的油站列表2023、10、1822,222，班结页面
export const getStationList = (data) => {
  return http.get("/prod-api/station/message/list", {
    params: data,
  });
};

// 油站列表---根据用户级别过滤
export const getStationListNew = (data) => {
  return http.get("/prod-api/station/message/listEnterpriseStation", {
    params: data,
  });
};

// 班结操作详情
export const stationInitiateClassSe = (data) => {
  return http.get("/prod-api/station/classSettlement/initiateClassSe", {
    params: data,
  });
};

// 确认班结
export const configCreateClassSe = (data) => {
  return http.get("/prod-api/station/classSettlement/createClassSe", {
    params: data,
  });
};
// 补打小票
export const exportClassSe = (data) => {
  return http.get("/prod-api/station/classSettlement/exportClassSe", {
    params: data,
  });
};

// 订单补打小票
export const historyOrderFeiePush = (data) => {
  return http.get("/prod-api/station/historyOrder/feiePush", {
    params: data,
  });
};

// 获取记录列表
export const getRecordList = (data) => {
  return http.get("/prod-api/station/classSettlement/list", {
    params: data,
  });
};

// 获取记录列表
export const getRecordDetail = (id, data) => {
  return http.get(`/prod-api/station/classSettlement/${id}`, {
    params: data,
  });
};

// 订单列表
export const historyOrderList = (data) => {
  return http.get("/prod-api/station/historyOrder/list", {
    params: data,
  });
};

// 订单总计
export const selectPayOrderSum = (data) => {
  return http.get("/prod-api/station/historyOrder/selectPayOrderSum", {
    params: data,
  });
};

// 订单总计
export const getEnterpriseandStation = (data) => {
  return http.get("/prod-api/enterprise/info/getEnterpriseandStation", {
    params: data,
  });
};

// 员工码汇总列表
export const getPayOrderEmployee = (data) => {
  return http.get("/prod-api/station/order/payOrderEmployee", {
    params: data,
  });
};

// 员工码订单详情
export const getPayOrderDetail = (data) => {
  return http.get("/prod-api/station/order/payOrderDetail", {
    params: data,
  });
};

// 是否是员工
export const employeePermission = () => {
  return http.get("/prod-api/station/order/employeePermission");
};

// 调整油价获取油站
export const getStationInfo = () => {
  return http.get("/prod-api/station/message/getStationInfo");
};

// 小程序根据油企或者油站获取所有油品
export const getListByEnterpriseOrStationId = (data) => {
  return http.get("/prod-api/oil/info/getListByEnterpriseOrStationId", {
    params: data,
  });
};

// 小程序更新价格
export const smallProgramUpdateOilGunPrice = (data) => {
  return http.put(
    "/prod-api/stationOillGun/info/smallProgramUpdateOilGunPrice",
    data
  );
};

// 扫码核销优惠券
export const cancelCoupon = (data) => {
  return http.post("/prod-api/coupon/creation/cancelCoupon", data);
};

// 获取用户等级
export const getUserPermissions = (data) => {
  return http.get("/prod-api/staff/getUserPermissions", {
    params: data,
  });
};

// GET /functionConfig/report/list 查询报表功能配置列表
export const reportList = (data) => {
  return http.get("/prod-api/functionConfig/report/list", {
    params: data,
  });
};

// export const getChargeOrderListApi = (data) =>{
// 	return http.get("/prod-api/getCardRecordList",{
// 		params:data
// 	})
// }

//  获取充值订单列表
export const getChargeOrderListApi = (data) => {
  return http.post("/prod-api/applet/all/record", data);
};

// 查询所有充值订单统计
export const getChargeOrderSumApi = (data) => {
  return http.post("/prod-api/applet/all/record/statistics", data);
};

// POST /system/user/checkUserPwd 用户密码校验(客户端)
export const checkUserPwd = (data) => {
  return http.post("/prod-api/system/user/checkUserPwd", data);
};

// POST /system/user/updateUserPwd 修改密码(客户端)
export const updateUserPwd = (data) => {
  return http.post("/prod-api/system/user/updateUserPwd", data);
};

// 取订单的默认时间
export const changeTimeOrder = (data) => {
  return http.get("/prod-api/station/order/selectPosDefaultQueryPeriod", {
		params:data
 	});
};
// 取班结的默认时间
export const changeTimeClass = (data) => {
  return http.get("/prod-api/station/order/selectPosClassDefaultQueryPeriod", {
		params:data
 	});
};
// 开启关闭设备
export const sendMessageApi = (data) => {
  return http.post("/prod-api/sendMessage", data);
};
// 查询继电器剩余时间
export const getSwitchStatusApi = (data) => {
  return http.get("/prod-api/selectSwitchStatus", {
    params: data,
  });
};
